using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public abstract class BasePanel
{
    public UIType uitype{ get; private set; }
    public UITool uitool { get; private set; }
    public PanelManager panelmanager { get; private set; }
    public UIManager uimanager { get; private set; }
    public BasePanel(UIType UItype)
    {
        uitype = UItype;
    }
    public void Initialize(UITool tool)
    {
        uitool = tool;
    }
    public void Initialize(PanelManager manager)
    {
        panelmanager=manager;
    }
    public void Initialize(UIManager UImanager)
    {
        uimanager = UImanager;
    }
    public virtual void OnEnter() { }

    public virtual void OnPause() {
        uitool.GetOrAddComponent<CanvasGroup>().blocksRaycasts = false;
    }

    public virtual void OnResume() {
        uitool.GetOrAddComponent<CanvasGroup>().blocksRaycasts = true;
    }

    public virtual void OnExit()
    {
        uimanager.DestroyUI(uitype);
    }
    public void Push(BasePanel panel) => panelmanager?.Push(panel);
    public void Pop() => panelmanager?.Pop();
}
